/**
* CommonConstants.java 2020/5/11 11:45 上午
* Copyright ©2020 wondersgroup.com All rights reserved.
* PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package common.constants;

import java.util.concurrent.ExecutorService;
import java.util.regex.Pattern;

/**
 * File：CommonConstants.java<br>
 * Title: <br>
 * Description: <br>
 * Company: www.treefinance.com.cn <br>
 * @author heyouchi
 */
public interface CommonConstants {

  String VERSION = "1.0";

  String PROTOCOL_VERSION = "1.0";

  String DEFAULT_KEY_PREFIX = "default.";

  String MAGIC = "magic";

  String PROVIDER = "provider";

  String CONSUMER = "consumer";

  String APPLICATION_KEY = "application";

  String REMOTE_APPLICATION_KEY = "remote.application";

  String ENABLED_KEY = "enabled";

  String DISABLED_KEY = "disabled";

  String MAGIC_PROPERTIES_KEY = "magic.properties.file";

  String DEFAULT_MAGIC_PROPERTIES = "magic.properties";

  String ANY_VALUE = "*";

  String COMMA_SEPARATOR = ",";

  String DOT_SEPARATOR = ".";

  Pattern COMMA_SPLIT_PATTERN = Pattern.compile("\\s*[,]+\\s*");

  String PATH_SEPARATOR = "/";

  String PROTOCOL_SEPARATOR = "://";

  String REGISTRY_SEPARATOR = "|";

  Pattern REGISTRY_SPLIT_PATTERN = Pattern.compile("\\s*[|;]+\\s*");

  String SEMICOLON_SEPARATOR = ";";

  Pattern SEMICOLON_SPLIT_PATTERN = Pattern.compile("\\s*[;]+\\s*");

  Pattern EQUAL_SPLIT_PATTERN = Pattern.compile("\\s*[=]+\\s*");

  String DEFAULT_PROXY = "javassist";

  String DEFAULT_DIRECTORY = "magic";

  String PROTOCOL_KEY = "protocol";

  String DEFAULT_PROTOCOL = "magic";

  String DEFAULT_THREAD_NAME = "magic";

  int DEFAULT_CORE_THREADS = 0;

  int DEFAULT_THREADS = 200;

  String THREADPOOL_KEY = "threadpool";

  String THREAD_NAME_KEY = "threadname";

  String CORE_THREADS_KEY = "corethreads";

  String THREADS_KEY = "threads";

  String QUEUES_KEY = "queues";

  String ALIVE_KEY = "alive";

  String DEFAULT_THREADPOOL = "limited";

  String DEFAULT_CLIENT_THREADPOOL = "cached";

  String IO_THREADS_KEY = "iothreads";

  int DEFAULT_QUEUES = 0;

  int DEFAULT_ALIVE = 60 * 1000;

  String TIMEOUT_KEY = "timeout";

  int DEFAULT_TIMEOUT = 6000;

  String REMOVE_VALUE_PREFIX = "-";

  String PROPERTIES_CHAR_SEPERATOR = "-";

  String UNDERLINE_SEPARATOR = "_";

  String SEPARATOR_REGEX = "_|-";

  String GROUP_CHAR_SEPERATOR = ":";

  String HIDE_KEY_PREFIX = ".";

  String DOT_REGEX = "\\.";

  String DEFAULT_KEY = "default";

  /**
   * Default timeout value in milliseconds for server shutdown
   */
  int DEFAULT_SERVER_SHUTDOWN_TIMEOUT = 10000;

  String SIDE_KEY = "side";

  String PROVIDER_SIDE = "provider";

  String CONSUMER_SIDE = "consumer";

  String ANYHOST_KEY = "anyhost";

  String ANYHOST_VALUE = "0.0.0.0";

  String LOCALHOST_KEY = "localhost";

  String LOCALHOST_VALUE = "127.0.0.1";

  String METHODS_KEY = "methods";

  String METHOD_KEY = "method";

  String PID_KEY = "pid";

  String TIMESTAMP_KEY = "timestamp";

  String GROUP_KEY = "group";

  String PATH_KEY = "path";

  String INTERFACE_KEY = "interface";

  String FILE_KEY = "file";

  String DUMP_DIRECTORY = "dump.directory";

  String CLASSIFIER_KEY = "classifier";

  String VERSION_KEY = "version";

  String REVISION_KEY = "revision";

  /**
   * package version in the manifest
   */
  String RELEASE_KEY = "release";

  int MAX_PROXY_COUNT = 65535;

  String MONITOR_KEY = "monitor";
  String CLUSTER_KEY = "cluster";
  String USERNAME_KEY = "username";
  String PASSWORD_KEY = "password";
  String HOST_KEY = "host";
  String PORT_KEY = "port";
  String MAGIC_IP_TO_BIND = "MAGIC_IP_TO_BIND";
  String SHUTDOWN_WAIT_KEY = "magic.service.shutdown.wait";
  String MAGIC_PROTOCOL = "magic";

  String MAGIC_LABELS = "magic.labels";
  String MAGIC_ENV_KEYS = "magic.env.keys";

  String LOCAL_KEY = "local";

  String STUB_KEY = "stub";

  String MOCK_KEY = "mock";

  String DEPRECATED_KEY = "deprecated";

  String $ECHO = "$echo";

  String RETURN_PREFIX = "return ";

  String THROW_PREFIX = "throw";

  String FAIL_PREFIX = "fail:";

  String FORCE_PREFIX = "force:";

  String MERGER_KEY = "merger";

  String IS_SERVER_KEY = "isserver";

  String FORCE_USE_TAG = "magic.force.tag";

  String GENERIC_SERIALIZATION_NATIVE_JAVA = "nativejava";

  String GENERIC_SERIALIZATION_DEFAULT = "true";

  String GENERIC_SERIALIZATION_BEAN = "bean";

  String GENERIC_SERIALIZATION_PROTOBUF = "protobuf-json";

  String TPS_LIMIT_RATE_KEY = "tps";

  String TPS_LIMIT_INTERVAL_KEY = "tps.interval";

  long DEFAULT_TPS_LIMIT_INTERVAL = 60 * 1000;

  String AUTO_ATTACH_INVOCATIONID_KEY = "invocationid.autoattach";

  String STUB_EVENT_KEY = "magic.stub.event";

  boolean DEFAULT_STUB_EVENT = false;

  String STUB_EVENT_METHODS_KEY = "magic.stub.event.methods";

  String PROXY_KEY = "proxy";

  String EXECUTES_KEY = "executes";

  String REFERENCE_FILTER_KEY = "reference.filter";

  String INVOKER_LISTENER_KEY = "invoker.listener";

  String SERVICE_FILTER_KEY = "service.filter";

  String EXPORTER_LISTENER_KEY = "exporter.listener";

  String ACCESS_LOG_KEY = "accesslog";

  String ACTIVES_KEY = "actives";

  String ID_KEY = "id";

  String ASYNC_KEY = "async";

  String RETURN_KEY = "return";

  String TOKEN_KEY = "token";

  String INTERFACES = "interfaces";

  String GENERIC_KEY = "generic";

  String LOCAL_PROTOCOL = "injvm";

  String DEFAULT_REMOTING_SERVER = "grpc";

  String SCOPE_KEY = "scope";
  String SCOPE_LOCAL = "local";
  String SCOPE_REMOTE = "remote";
  /**
   * To decide whether to make connection when the client is created
   */
  String LAZY_CONNECT_KEY = "lazy";
  String $INVOKE = "$invoke";
  String $INVOKE_ASYNC = "$invokeAsync";

  String INPUT_KEY = "input";
  String OUTPUT_KEY = "output";
  /**
   * The limit of callback service instances for one interface on every client
   */
  String CALLBACK_INSTANCES_LIMIT_KEY = "callbacks";

  /**
   * The default limit number for callback service instances
   *
   * @see #CALLBACK_INSTANCES_LIMIT_KEY
   */
  int DEFAULT_CALLBACK_INSTANCES = 1;

  String BUFFER_KEY = "buffer";

  /**
   * default buffer size is 8k.
   */
  int DEFAULT_BUFFER_SIZE = 8 * 1024;

  int MAX_BUFFER_SIZE = 16 * 1024;

  int MIN_BUFFER_SIZE = 1 * 1024;

  String IDLE_TIMEOUT_KEY = "idle.timeout";

  int DEFAULT_IDLE_TIMEOUT = 600 * 1000;
  /**
   * max size of channel. default value is zero that means unlimited.
   */
  String ACCEPTS_KEY = "accepts";

  int DEFAULT_ACCEPTS = 0;

  String CONNECT_QUEUE_CAPACITY = "connect.queue.capacity";

  String CONNECT_QUEUE_WARNING_SIZE = "connect.queue.warning.size";

  int DEFAULT_CONNECT_QUEUE_WARNING_SIZE = 1000;

  String CHARSET_KEY = "charset";

  String DEFAULT_CHARSET = "UTF-8";

  /**
   * Every heartbeat duration / HEATBEAT_CHECK_TICK, check if a heartbeat should be sent. Every heartbeat timeout
   * duration / HEATBEAT_CHECK_TICK, check if a connection should be closed on server side, and if reconnect on
   * client side
   */
  int HEARTBEAT_CHECK_TICK = 3;

  /**
   * the least heartbeat during is 1000 ms.
   */
  long LEAST_HEARTBEAT_DURATION = 1000;

  /**
   * ticks per wheel.
   */
  int TICKS_PER_WHEEL = 128;
  String PAYLOAD_KEY = "payload";
  /**
   * 8M
   */
  int DEFAULT_PAYLOAD = 8 * 1024 * 1024;

  String CONNECT_TIMEOUT_KEY = "connect.timeout";

  int DEFAULT_CONNECT_TIMEOUT = 3000;

  String SERIALIZATION_KEY = "serialization";

  String DEFAULT_REMOTING_SERIALIZATION = "hessian2";

  String CODEC_KEY = "codec";

  String SERVER_KEY = "server";

  String CLIENT_KEY = "client";

  String DEFAULT_REMOTING_CLIENT = "netty";

  String TRANSPORTER_KEY = "transporter";

  String DEFAULT_TRANSPORTER = "netty";

  String EXCHANGER_KEY = "exchanger";

  String DEFAULT_EXCHANGER = "header";

  String DISPACTHER_KEY = "dispacther";

  int DEFAULT_IO_THREADS = Math.min(Runtime.getRuntime().availableProcessors() + 1, 32);

  String BIND_IP_KEY = "bind.ip";

  String BIND_PORT_KEY = "bind.port";

  String SENT_KEY = "sent";

  String DISPATCHER_KEY = "dispatcher";

  String CHANNEL_ATTRIBUTE_READONLY_KEY = "channel.readonly";

  String CHANNEL_READONLYEVENT_SENT_KEY = "channel.readonly.sent";

  String CHANNEL_SEND_READONLYEVENT_KEY = "channel.readonly.send";

  String EXECUTOR_SERVICE_COMPONENT_KEY = ExecutorService.class.getName();

  String RECONNECT_KEY = "reconnect";

  int DEFAULT_RECONNECT_PERIOD = 2000;

  String SEND_RECONNECT_KEY = "send.reconnect";

  String CHECK_KEY = "check";

  String PROMPT_KEY = "prompt";

  String DEFAULT_PROMPT = "magic>";
  String TELNET = "telnet";
  String HEARTBEAT_KEY = "heartbeat";
  int DEFAULT_HEARTBEAT = 60 * 1000;
  String HEARTBEAT_TIMEOUT_KEY = "heartbeat.timeout";
  String CONNECTIONS_KEY = "connections";
  String MAGIC_VERSION_KEY = "magic";
  String BACKUP_KEY = "backup";
}
